# -*- coding: utf-8 -*-

from django.conf.urls import patterns, include, url

from demo.views import hello

# 导入media
from django.conf import settings
from django.conf.urls.static import static

# 导入xadmin
import xadmin
xadmin.autodiscover()
from xadmin.plugins import xversion
xversion.register_models()


urlpatterns = patterns('',
    # url('^hello/$', hello),                    # version 1
    # url('^hello/$', 'demo.views.hello'),       # version 2
    # url('^hello/(.+)/$', 'demo.views.hello'),  # version 3
    # url('^hello/(?P<name>.+)/$', 'demo.views.hello'),  # version 4
    url(r'^admin/', include(xadmin.site.urls)),       # xadmin
    # 查询
    url(r'^query_all/$', 'demo.views.query_all'),
    url(r'^query_get/(?P<name>.+)/$', 'demo.views.query_get'),
    url(r'^query_filter/(?P<name>.+)/(?P<cls>.+)/$', 'demo.views.query_filter'),
    # 添加
    url(r'^add_student/(?P<name>.+)/(?P<cls>.+)/$', 'demo.views.add_student'),
    # 修改
    url(r'^update_student/(?P<name>.+)/(?P<remark>.+)', 'demo.views.update_student'),
    # 删除
    url(r'^delete_student/(?P<name>.+)/', 'demo.views.delete_student'),


) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
